
[dbo].[asi_SetAppealParticipationResponseTypeCodes]
CREATE PROCEDURE [dbo].[asi_SetAppealParticipationResponseTypeCodes]
@respondentKey uniqueidentifier,
@appealKey uniqueidentifier,
@responseTypeCode int
AS
BEGIN
SET NOCOUNT ON;
BEGIN TRAN
DECLARE @campaignKey UNIQUEIDENTIFIER
DECLARE @returnCount int
SET @returnCount = 0
SELECT @campaignKey = cm.CampaignKey
FROM CampaignMain cm
INNER JOIN AppealMain am ON am.CampaignKey = cm.CampaignKey
WHERE am.AppealKey=@appealKey
UPDATE AppealParticipation
SET
ResponseTypeCode=@responseTypeCode
FROM AppealParticipation ap
INNER JOIN AppealMain am ON ap.AppealKey = am.AppealKey
INNER JOIN CampaignMain cm ON am.CampaignKey = cm.CampaignKey
WHERE ap.RespondentUserKey=@respondentKey
AND cm.CampaignKey = @campaignKey
SET @returnCount = @@ROWCOUNT
SELECT @returnCount AS ReturnCount
COMMIT TRAN
END
GO